<?php

require_once 'Mobitv/Admin/Action.php';

class LogoutAction extends Mobitv_Admin_Action{
    public function execute()    {
        $this->setOption('output', FALSE);
        $userDao = Vega_Dao::factory('Mobitv_Admin_Admin');
        $userDao->updateLogoutStatus();
        $this->updateLogAdmin($_SESSION['userid'], 'logout', $_SESSION['userid'], 'logout');
        unset($_SESSION['userid']);
        unset($_SESSION['username']);
        unset ($_SESSION['admin_time_out']);
        // Delete cookies
        setcookie ("userid", "", time() - 3600, "/");
        setcookie ("username", "", time() - 3600, "/");
        setcookie ("userhash", "", time() - 3600, "/");
        $this->redirect("/");
    }
}